package com.qf.java2201.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @date 2022/3/31
 * @desc   封装响应结果    json 数据  对象
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R<T> {

    private Integer code;

    private String msg;

    private T data;

    private long count;




    public static R ok(){
        R r = new R(0,"success",null,0);
        return r;
    }

    public  static R ok(Integer code,String msg){
        R r = new R();
        r.setCode(code);
        r.setMsg(msg);
        return r;
    }

    public static R error(){
        R r = new R(-1,"error",null,0);
        return r;
    }
}
